Skip to content

fix: take the UPower device-removed object path as a string - #49

Merged
mirkobrombin merged 1 commit into
singularityos-lab:mainfrom
ncz-os:fix/upower-device-removed-path
Nov 23, 2026
Merged

mirkobrombin merged 1 commit into
singularityos-lab:mainfrom
ncz-os:fix/upower-device-removed-path

Conversation

@perlowja

Copy link
Copy Markdown
Contributor

libupower-glib emits device-removed with the device object path, not a device object. The bundled upower-glib.vapi declared the argument as a UPower.Device, so DeviceChargingIndicator.on_device_removed used the path string as an object and the shell segfaulted when a Bluetooth keyboard or mouse disconnected.

The vapi now declares device_removed (string object_path) and adds Device.get_object_path; the handler finds the watched device by path and disconnects it.

Checked against libupower-glib 1.91.5 in a debian:forky container: with the old declaration a handler that touches the argument exits 139; with the new one the handler receives the path and exits 0. Removing the first, middle and last item from a Gee.ArrayList inside foreach followed by break was also run and is clean.

AI assistance: disclosed

libupower-glib emits device-removed with the object path, not a device object. The vapi declared a UPower.Device, so the charging indicator treated the string as an object and crashed when a Bluetooth device disconnected.

Assisted-by: Claude Code:claude-sonnet-5-5
AI-Scope: Located the root cause, wrote the vapi and handler change and the reproducer that shows the crash before and the clean exit after.
@perlowja

Copy link
Copy Markdown
Contributor Author

@mirkobrombin this fixes a shell crash when a Bluetooth device disconnects. Companion vapi fix: singularityos-lab/libsingularity#21.

@mirkobrombin
mirkobrombin merged commit db2aff9 into singularityos-lab:main Nov 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants